﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace MyWindowsServices
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 启动
        /// </summary>
        /// <param name="args"></param>
        protected override void OnStart(string[] args)
        {
            string resString = WebApiUtil.HttpPost("http://10.99.101.28:90/SysBaseInfo.asmx/GetRolesInfo", "wyappuser", "1qaz2wsx");
           var Log = log4net.LogManager.GetLogger(typeof(Service1).Name);
            Log.Info("服务已经启动完毕！");
        }

        protected override void OnStop()
        {
            var Log = log4net.LogManager.GetLogger(typeof(Service1).Name);
            try
            {
                Log.Info("服务已经停止完毕！");
            }
            catch (Exception ex)
            {
                Log.Info(ex.Message.ToString());
                throw;
            }

        }


        protected override void OnPause()
        {

            var Log = log4net.LogManager.GetLogger(typeof(Service1).Name);
            try
            {
                Log.Info("服务已经暂停完毕！");
            }
            catch (Exception ex)
            {
                Log.Info(ex.Message.ToString());
                throw;
            }
        }
    }
}
